package com.grass.p019lv.novel.adapter;

import android.content.Intent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.androidsa.bttsddka.R;
import com.androidx.p013lv.base.dialog.BuyVipDialog;
import com.androidx.p013lv.base.interfaces.Key;
import com.androidx.p013lv.base.listener.ItemClickListener;
import com.androidx.p013lv.base.recycler.BaseRecyclerAdapter;
import com.androidx.p013lv.base.recycler.BaseRecyclerHolder;
import com.androidx.p013lv.base.utils.SpUtils;
import com.grass.p019lv.OnClickListenType;
import com.grass.p019lv.bean.AudioRecommendBean;
import com.grass.p019lv.novel.activity.AudioFictionLabelActivity;
import com.grass.p019lv.novel.activity.VoiceNovelActivityNew;

/* renamed from: com.grass.lv.novel.adapter.AudioFictionAAdapterType */
public class AudioFictionAAdapterType extends BaseRecyclerAdapter<AudioRecommendBean.AudioRecommendBeanData, Holder> {
    String domain;
    OnClickListenType onClickListenType;

    public void setDomain(String str) {
        this.domain = str;
    }

    public AudioFictionAAdapterType(OnClickListenType onClickListenType2) {
        this.onClickListenType = onClickListenType2;
    }

    public void MyHolder(Holder holder, int i) {
        holder.setData((AudioRecommendBean.AudioRecommendBeanData) this.list.get(i), i);
    }

    public void onViewRecycled(Holder holder) {
        super.onViewRecycled((RecyclerView.ViewHolder) holder);
    }

    @Override // androidx.recyclerview.widget.RecyclerView.Adapter
    public Holder onCreateViewHolder(ViewGroup viewGroup, int i) {
        return new Holder(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_audio_fiction_one, viewGroup, false));
    }

    /* access modifiers changed from: package-private */
    /* renamed from: com.grass.lv.novel.adapter.AudioFictionAAdapterType$Holder */
    public class Holder extends BaseRecyclerHolder {
        AudioFictionOneViewAdapter adapter;
        RecyclerView recycler;
        TextView tv_audio_changeBatch;
        TextView tv_more_works;
        TextView tv_name;

        public Holder(View view) {
            super(view);
            this.tv_name = (TextView) view.findViewById(R.id.tv_name);
            this.tv_more_works = (TextView) view.findViewById(R.id.tv_more_works);
            this.tv_audio_changeBatch = (TextView) view.findViewById(R.id.tv_audio_changeBatch);
            this.recycler = (RecyclerView) view.findViewById(R.id.recycler);
        }

        public void setData(final AudioRecommendBean.AudioRecommendBeanData audioRecommendBeanData, final int i) {
            TextView textView = this.tv_name;
            textView.setText(audioRecommendBeanData.getStationName() + "");
            RecyclerView recyclerView = this.recycler;
            recyclerView.setLayoutManager(new GridLayoutManager(recyclerView.getContext(), 3));
            AudioFictionOneViewAdapter audioFictionOneViewAdapter = new AudioFictionOneViewAdapter();
            this.adapter = audioFictionOneViewAdapter;
            this.recycler.setAdapter(audioFictionOneViewAdapter);
            this.adapter.setDomain(AudioFictionAAdapterType.this.domain);
            this.adapter.setData(audioRecommendBeanData.getFictionBaseList());
            this.adapter.setItemListener(new ItemClickListener() {
                /* class com.grass.p019lv.novel.adapter.AudioFictionAAdapterType.Holder.C31311 */

                @Override // com.androidx.p013lv.base.listener.ItemClickListener
                public void onItemClick(View view, int i) {
                    if (SpUtils.getInstance().getUserInfo().getFreeWatches() != -1) {
                        new BuyVipDialog(view.getContext()).show();
                        return;
                    }
                    int fictionId = ((AudioRecommendBean.AudioRecommendBeanData.FictionBaseListBean) Holder.this.adapter.getDataInPosition(i)).getFictionId();
                    Intent intent = new Intent(view.getContext(), VoiceNovelActivityNew.class);
                    intent.putExtra(Key.NOVEL_ID, fictionId);
                    view.getContext().startActivity(intent);
                }
            });
            this.tv_more_works.setOnClickListener(new View.OnClickListener() {
                /* class com.grass.p019lv.novel.adapter.AudioFictionAAdapterType.Holder.View$OnClickListenerC31322 */

                public void onClick(View view) {
                    Intent intent = new Intent(view.getContext(), AudioFictionLabelActivity.class);
                    intent.putExtra(Key.TITLE, audioRecommendBeanData.getStationName());
                    intent.putExtra("stationId", audioRecommendBeanData.getStationId());
                    intent.putExtra("type", 1);
                    view.getContext().startActivity(intent);
                }
            });
            this.tv_audio_changeBatch.setOnClickListener(new View.OnClickListener() {
                /* class com.grass.p019lv.novel.adapter.AudioFictionAAdapterType.Holder.View$OnClickListenerC31333 */

                public void onClick(View view) {
                    AudioFictionAAdapterType.this.onClickListenType.onClick(audioRecommendBeanData, i, view.getId());
                }
            });
        }
    }
}
